/*
Copyright (c) 2010 Andreas Bjerkeholt
License: MIT
http://www.opensource.org/licenses/mit-license.php
*/
#ifndef __controller_sml_h__
#define __controller_sml_h__

#include <sml/control.h>

#define CONTROL_UP       CONTROL_DPAD_UP
#define CONTROL_DOWN     CONTROL_DPAD_DOWN
#define CONTROL_LEFT     CONTROL_DPAD_LEFT
#define CONTROL_RIGHT    CONTROL_DPAD_RIGHT
#define CONTROL_BUTTON1  CONTROL_BUTTON_A
#define CONTROL_BUTTON2  CONTROL_BUTTON_B
#define CONTROL_BUTTON3  CONTROL_BUTTON_X
#define CONTROL_BUTTON4  CONTROL_BUTTON_Y
#define CONTROL_BUTTON5  CONTROL_BUTTON_START
#define CONTROL_BUTTON6  CONTROL_BUTTON_SELECT
#define CONTROL_L        CONTROL_TRIGGER_LEFT
#define CONTROL_R        CONTROL_TRIGGER_RIGHT

bool controlInit();
void controlUnload();
#define controlUpdate() control_poll()

#define controlJustPressed(inControl)   ( control_check(inControl).pressed &&  control_check(inControl).changed)
#define controlJustReleased(inControl)  (!control_check(inControl).pressed &&  control_check(inControl).changed)
#define controlPressed(inControl)  ( control_check(inControl).pressed)
#define controlReleased(inControl) (!control_check(inControl).pressed)
#define controlRepeat(inControl)   ( control_check(inControl).repeat)

#endif
